import { createRouter, createWebHistory } from 'vue-router'
import pinia from '@/stores'
import interceptor from '@/router/permission' // 路由权限控制

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: 'root',
      redirect: '/home',
      component: () => import('../components/Layout/Layout.vue'),
      children: []
    },
    {
      path: "/login",
      name: "login",
      component: () => import('../views/Login/index.vue')
    }
  ]
})

interceptor(router, pinia)

export default router
